import {Locale} from "./Locale";
export const Requried = { required: true, message: Locale("Requried"), trigger: 'blur' }; //输入必填项
export const RequriedSelect = { required: true, message: Locale("RequriedSelect"),trigger: 'change'};//选择必填项
export const RequriedDate = { type: 'date',required: true,message: Locale("RequriedDate"),trigger: 'change'};//日期必填项
export const RequriedArray = { type: 'array',required: true,  message: Locale("RequriedArray"),trigger: 'change',};//数组必填项


export const RegNumber = {pattern:/^-?\d+(\.\d+)?$/,message: Locale("RegIntger")}; //数字正则，包含正负小数
export const RegIntger = {pattern:/^-?\d+$/,message: Locale("RegIntger")}; //整数正则
export const RegPositiveInteger = {pattern:/^\d+$/,message: Locale("RegPositiveInteger")}; //正整数正则
export const RegMoney = {pattern:/^\d+(\.\d+)?$/,message: Locale("RegMoney")};//金额正则即正数
// export const RegTelephone ={pattern:/^1\d{10}$/,message: Locale("RegTelephone")};//手机号正则
export const RegEmail = {pattern:/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/,message: Locale("RegEmail")};//邮箱正则
export const RegTelephone ={pattern:/^\w{6,18}$/,message: Locale("RegTelephone")};//手机号正则


// 长度校验
export const LimitLength = (max,min)=>{
    if(!max || max == 0){
        return {};
    };
    if(!min){
        return {max:max,message:Locale("LimitLengthMax",{max:max}), trigger: 'blur'};
    };
    return  {max:max,min:min,message:Locale("LimitLengthMaxMin",{max,min}), trigger: 'blur'};
};
